<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Free Software" and "Free Software Needs
Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
and with the Back-Cover Texts as in (a) below.

(a) The FSF's Back-Cover Text is: "You are free to copy and modify
this GNU Manual.  Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom." -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Debugging with GDB: Running Configure</title>

<meta name="description" content="Debugging with GDB: Running Configure">
<meta name="keywords" content="Debugging with GDB: Running Configure">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Installing-GDB.html#Installing-GDB" rel="up" title="Installing GDB">
<link href="Separate-Objdir.html#Separate-Objdir" rel="next" title="Separate Objdir">
<link href="Requirements.html#Requirements" rel="prev" title="Requirements">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Running-Configure"></a>
<div class="header">
<p>
Next: <a href="Separate-Objdir.html#Separate-Objdir" accesskey="n" rel="next">Separate Objdir</a>, Previous: <a href="Requirements.html#Requirements" accesskey="p" rel="prev">Requirements</a>, Up: <a href="Installing-GDB.html#Installing-GDB" accesskey="u" rel="up">Installing GDB</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Invoking-the-GDB-configure-Script"></a>
<h3 class="section">C.2 Invoking the <small>GDB</small> <samp>configure</samp> Script</h3>
<a name="index-configuring-GDB"></a>
<p><small>GDB</small> comes with a <samp>configure</samp> script that automates the process
of preparing <small>GDB</small> for installation; you can then use <code>make</code> to
build the <code>gdb</code> program.
</p>
<p>The <small>GDB</small> distribution includes all the source code you need for
<small>GDB</small> in a single directory, whose name is usually composed by
appending the version number to &lsquo;<samp>gdb</samp>&rsquo;.
</p>
<p>For example, the <small>GDB</small> version 7.12.1.20170417-git distribution is in the
<samp>gdb-7.12.1.20170417-git</samp> directory.  That directory contains:
</p>
<dl compact="compact">
<dt><code>gdb-7.12.1.20170417-git/configure <span class="roman">(and supporting files)</span></code></dt>
<dd><p>script for configuring <small>GDB</small> and all its supporting libraries
</p>
</dd>
<dt><code>gdb-7.12.1.20170417-git/gdb</code></dt>
<dd><p>the source specific to <small>GDB</small> itself
</p>
</dd>
<dt><code>gdb-7.12.1.20170417-git/bfd</code></dt>
<dd><p>source for the Binary File Descriptor library
</p>
</dd>
<dt><code>gdb-7.12.1.20170417-git/include</code></dt>
<dd><p><small>GNU</small> include files
</p>
</dd>
<dt><code>gdb-7.12.1.20170417-git/libiberty</code></dt>
<dd><p>source for the &lsquo;<samp>-liberty</samp>&rsquo; free software library
</p>
</dd>
<dt><code>gdb-7.12.1.20170417-git/opcodes</code></dt>
<dd><p>source for the library of opcode tables and disassemblers
</p>
</dd>
<dt><code>gdb-7.12.1.20170417-git/readline</code></dt>
<dd><p>source for the <small>GNU</small> command-line interface
</p>
</dd>
<dt><code>gdb-7.12.1.20170417-git/glob</code></dt>
<dd><p>source for the <small>GNU</small> filename pattern-matching subroutine
</p>
</dd>
<dt><code>gdb-7.12.1.20170417-git/mmalloc</code></dt>
<dd><p>source for the <small>GNU</small> memory-mapped malloc package
</p></dd>
</dl>

<p>The simplest way to configure and build <small>GDB</small> is to run <samp>configure</samp>
from the <samp>gdb-<var>version-number</var></samp> source directory, which in
this example is the <samp>gdb-7.12.1.20170417-git</samp> directory.
</p>
<p>First switch to the <samp>gdb-<var>version-number</var></samp> source directory
if you are not already in it; then run <samp>configure</samp>.  Pass the
identifier for the platform on which <small>GDB</small> will run as an
argument.
</p>
<p>For example:
</p>
<div class="smallexample">
<pre class="smallexample">cd gdb-7.12.1.20170417-git
./configure <var>host</var>
make
</pre></div>

<p>where <var>host</var> is an identifier such as &lsquo;<samp>sun4</samp>&rsquo; or
&lsquo;<samp>decstation</samp>&rsquo;, that identifies the platform where <small>GDB</small> will run.
(You can often leave off <var>host</var>; <samp>configure</samp> tries to guess the
correct value by examining your system.)
</p>
<p>Running &lsquo;<samp>configure <var>host</var></samp>&rsquo; and then running <code>make</code> builds the
<samp>bfd</samp>, <samp>readline</samp>, <samp>mmalloc</samp>, and <samp>libiberty</samp>
libraries, then <code>gdb</code> itself.  The configured source files, and the
binaries, are left in the corresponding source directories.
</p>
<p><samp>configure</samp> is a Bourne-shell (<code>/bin/sh</code>) script; if your
system does not recognize this automatically when you run a different
shell, you may need to run <code>sh</code> on it explicitly:
</p>
<div class="smallexample">
<pre class="smallexample">sh configure <var>host</var>
</pre></div>

<p>If you run <samp>configure</samp> from a directory that contains source
directories for multiple libraries or programs, such as the
<samp>gdb-7.12.1.20170417-git</samp> source directory for version 7.12.1.20170417-git,
<samp>configure</samp>
creates configuration files for every directory level underneath (unless
you tell it not to, with the &lsquo;<samp>--norecursion</samp>&rsquo; option).
</p>
<p>You should run the <samp>configure</samp> script from the top directory in the
source tree, the <samp>gdb-<var>version-number</var></samp> directory.  If you run
<samp>configure</samp> from one of the subdirectories, you will configure only
that subdirectory.  That is usually not what you want.  In particular,
if you run the first <samp>configure</samp> from the <samp>gdb</samp> subdirectory
of the <samp>gdb-<var>version-number</var></samp> directory, you will omit the
configuration of <samp>bfd</samp>, <samp>readline</samp>, and other sibling
directories of the <samp>gdb</samp> subdirectory.  This leads to build errors
about missing include files such as <samp>bfd/bfd.h</samp>.
</p>
<p>You can install <code>gdb</code> anywhere; it has no hardwired paths.
However, you should make sure that the shell on your path (named by
the &lsquo;<samp>SHELL</samp>&rsquo; environment variable) is publicly readable.  Remember
that <small>GDB</small> uses the shell to start your program&mdash;some systems refuse to
let <small>GDB</small> debug child processes whose programs are not readable.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Separate-Objdir.html#Separate-Objdir" accesskey="n" rel="next">Separate Objdir</a>, Previous: <a href="Requirements.html#Requirements" accesskey="p" rel="prev">Requirements</a>, Up: <a href="Installing-GDB.html#Installing-GDB" accesskey="u" rel="up">Installing GDB</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
